
; now-what? (with ending for make-distribution)
; this is read in at very end of maker when *make-distribution* is t

(defun now-what? ()
"currently setup so that (make-distribution) always uses old code (make-vista) uses new. this may be ok in the long run"
  (if *please-wait* (send *please-wait* :remove))
  (if *make-distribution* 
      (distributors-now-what)
      (new-now-what)))

(defun take-a-look ()
	(format t "; Type (PLEASE-RESUME) to resume makeing ViSta.~%")
        (please-wait "Type (PLEASE-RESUME) to resume makeing ViSta")
	(top-level nil)
	(top-level nil)
(top-level nil)
	)

(defun please-resume ()
  (now-what?))

(defun old-now-what ()
  (setf *tracelimit* 3)
  (setf *visible-startup* nil)
  (setf *debug-mode* nil)
  (setf *rebuild-after-compile-needed* nil)
  (when *please-wait*
    (send *please-wait* :remove)
    (setf *please-wait* nil))
  ;(hidemainwindow)
  (setf *statinit-maker-error-flag* nil)
  (setf *make-time* nil)
  (verbose nil)
  (setf *vista-start-case* 3)
  (setf *run-number* -10)
  (setf *initial-install* t)
  (write-prefload-file *make-distribution*)
  (msw-write-profile-string "XLisp" "HideMainFrame" "No" "wxls32.ini")
  (msw-write-profile-string "ViSta" "ViStaOp" "No" "wxls32.ini")
  (msw-write-profile-string "ViSta" "ViStaRunning" "No" "wxls32.ini")
  (save-workspace "vista-installer.wks"))

(defun distributors-now-what ()
    (format t "; constructing configuration options dialog~%")
    (let* ((t0 (send text-item-proto :new 
                     (format nil 
                             "~A WORKSPACE PREPARED~%"
                             (if *make-distribution* "DISTRIBUTOR'S"
                                 "DEVELOPER'S"))))
           (t1 (send text-item-proto :new "Configure WorkSpace Using:"))
           (c1 (send choice-item-proto :new 
                     (list "DISTRIBUTION Configuration"
                           "CURRENT Configuration" 
                           "INITIAL Configuration"
                           "CUSTOMIZED with DIALOGS"
                           "STOP! DONT SAVE!"
                           )
                     :value *after-making-vista-choice*))
           (c4 (send toggle-item-proto :new "Automatic Restart?"))
           (t2 (send text-item-proto :new 
                     (format nil "Restart Options~%(Not Implemented)")))
           (c2 (send choice-item-proto :new (list "Restart in Developer Mode"  "Restart in User Mode")))
           (t3 (send text-item-proto :new "Options")) 
           (c3 (send toggle-item-proto :new "Inspect WorkSpace Configuration"
                     :action #'installation-summary))
           (c5 (send toggle-item-proto :new "Inspect Paths"
                     :action #'display-ini-paths))
           ;(stats (send text-item-proto :new (project-stats)))
           (ok (send modal-button-proto :new   "     OK - SAVE WORKSPACE!     "
                     :action #'(lambda () (list (send c1 :value)
                                                (send c2 :value) (send c3 :value)
                                                (send c4 :value) (send c5 :value)))))
           (stop-but)
           (exit-but)
           (stop (send modal-button-proto :new "STOP WITHOUT SAVING OR EXITING"
                     :action #'(lambda () (setf stop-but t))))
           (exit (send modal-button-proto :new "   EXIT WITHOUT SAVING IT!    "
                     :action #'(lambda () (setf exit-but t))))
           (dialog (send modal-dialog-proto :new
                         ;(list c3  ok stop  exit)
                         (list ok stop  exit)
                         :title "WORKSPACE CONSTRUCTED"))
           (result (send dialog :modal-dialog))
           (action) 
           (install-summary)
           (restart?))
      (cond
        (exit-but  (exit))
        (stop-but (take-a-look))
        (t
      (defun please-resume ())
      (setf action (first result))
      (setf restart? nil)
      (case (second result)
        (1 (setf *force-user-mode* t) (user-mode)))
      (setf install-summary (third result))
      (case action
        (0 ;distribution
           (old-now-what)
           (exit))
        (1 ;current
           (setf *vista-start-case* 2))
        (2 ;initial
           (setup-install-vista)
           (update-installation-info)
           (setf *initial-install* nil)
           (setf *visible-startup* nil)
           (setf *show-flying-logo* t)
           (setf *show-zooming-desktop* t)
           (setf *show-flying-exit-logo* t)
           (setf *vista-start-case* 2);3
           )
        (3 ;dialogs
           (setf *vista-start-case* 3)
        (4 ;stop
           (setf *vista-start-case* 0)
           (exit))
           ))
      (msw-write-profile-string "XLisp" "HideMainFrame" "No" "wxls32.ini")
      (msw-write-profile-string "ViSta" "ViStaOp" "No" "wxls32.ini")
      (msw-write-profile-string "ViSta" "ViStaRunning" "No" "wxls32.ini")
      (write-prefload-file nil *prefs-path*)
(listeners)
      (print-closing-workspace-id-info "Developer's" "Unlocalized")
(break)
      (case action
        (1 (save-current-workspace "xlisp.wks" restart? install-summary))
        (2 (save-default-workspace "xlisp.wks" restart? install-summary))
        (3 (save-custom-workspace  "xlisp.wks" restart? install-summary))
        (0 (when (probe-file "xlisp.bak")
                 (rename-file "xlisp.bak" "xlisp.wks")
                 (format t "; renamed xlisp.bak -> xlisp.wks ~%")
                 (setf *vista-start-case* 9)
                 (setf *statinit-maker-error-flag* nil))))
      ))))

